﻿@using System.Web.Services.Description
@using DevExpress.Web.ASPxEditors
@using DevExpress.Web.Mvc.UI
@using Dogshow.Model
@using Dogshow.Web.Controllers
@model Dogshow.Model.KinoloskoDrustvo

@{
    ViewBag.Title = "Dogshow - kinološka društva";
    Html.EnableClientValidation(true);
    Html.EnableUnobtrusiveJavaScript(true);
}
<script type="text/javascript">
    var id = null;
    
    function onBeginVratiKinoloskoDrustvo(s, e) {
        e.customArgs["Id"] = id;
        id = null;
    }

    function onEndVratiKinoloskoDrustvo(s, e) {
        if (id != null) {
            cbKinoloskoDrustvo.PerformCallback();            
        }
    }
    
    function onFocusedRowChanged(s, e)
    {
        resetValidation();

        s.GetRowValues(s.GetFocusedRowIndex(), "Id", function (value) {
            id = value;
            if (!cbKinoloskoDrustvo.IsCallback) {
                cbKinoloskoDrustvo.PerformCallback();
            }
        });
    }

    function resetValidation() {
//        Naziv.SetIsValid(true);
//        Adresa.SetIsValid(true);
//        IdMesta.SetIsValid(true);
//        Telefon.SetIsValid(true);
//        Faks.SetIsValid(true);
//        EMail.SetIsValid(true);
        //        TekuciRacun.SetIsValid(true);
        ASPxClientEdit.ClearEditorsInContainer();
    }

    function onNoviUnos() {
        resetValidation();
        $("#Id").val(0);
        Naziv.SetText("");
        Adresa.SetText("");
        IdMesta.SetText("");
        Telefon.SetText("");
        Faks.SetText("");
        EMail.SetText("");
        TekuciRacun.SetText("");

        Naziv.Focus();
    }

    
</script>
<div style="float:left;margin-right: 10px">
    @Html.Partial("KinoloskaDrustvaGrid")
</div>
<div style="width: 400px; margin-left: 310px;">
    @Html.Partial("KinoloskoDrustvoCallbackPanel", Model)
</div>
